Claude/fix editor upload q5 qk g#24
Merged
Merged
Conversation
…oad endpoints The upload endpoints were returning HTTP 400 (ValidationProblemDetails) because ASP.NET Core's model binding was failing when trying to bind the subfolder parameter from form data that wasn't being sent by the client. Root cause: - The [FromForm] attribute expects the parameter to be in the multipart form data - The client uploads files but doesn't include the subfolder parameter - Even though the parameter is nullable with a default value, the binding fails Solution: - Changed [FromForm] to [FromQuery] for the subfolder parameter in both: - UploadClientFiles endpoint (api/v1/editor/updates/client) - UploadEditorFiles endpoint (api/v1/editor/updates/editor) - This allows the parameter to be read from the query string - Works correctly when the parameter is omitted (defaults to null) This is the proper approach for optional string parameters in file upload endpoints, as mixing form fields with multipart file uploads can cause validation issues in ASP.NET Core. Fixes the HTTP 400 error that was blocking all upload attempts.
Added critical attributes to both upload endpoints to properly handle
large multipart file uploads from the editor:
1. [Consumes("multipart/form-data")]
- Explicitly declares the endpoint accepts multipart form data
- Helps ASP.NET Core routing and model binding understand the content type
- Improves API documentation in Swagger
2. [DisableRequestSizeLimit]
- Removes the default 30MB request size limit
- Allows uploading large game asset packages without size restrictions
- Essential for editor uploads which can contain hundreds of MB of assets
3. [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue, ValueLengthLimit = int.MaxValue)]
- Removes limits on multipart body length and individual value length
- Prevents HTTP 400 errors from default ASP.NET Core form size limits
- Allows batched uploads of many files at once
Also added:
- using Microsoft.AspNetCore.Http.Features; for RequestFormLimits attribute
Without these attributes, ASP.NET Core's default FormOptions would reject
requests that exceed the built-in limits, resulting in HTTP 400 Bad Request
errors before the controller method is even reached.
These changes complement the previous fix that changed [FromForm] to
[FromQuery] for the subfolder parameter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.